package com.controller.hht;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bean.hht.Company;
import com.bean.hht.University;
import com.config.Result;
import com.mapper.hht.CompanyMapper;
import com.mapper.hht.UniversityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class LikeselectUCController {
    @Autowired
    UniversityMapper universityMapper;
    @Autowired
    CompanyMapper companyMapper;

    @RequestMapping(value = "findcompany",method = RequestMethod.GET)
    public Result findcompany(@RequestParam(value = "company")String company){
        QueryWrapper<Company> wrapper=new QueryWrapper<>();
        wrapper.like("company",company);
        List<Map<String,Object>> companies=companyMapper.selectMaps(wrapper);
        return new Result(companies);
    }


    @RequestMapping(value = "findschool",method = RequestMethod.GET)
    public Result findschool(@RequestParam(value = "school")String school){
        QueryWrapper<University> wrapper=new QueryWrapper<>();
        wrapper.like("university",school);
        List<Map<String, Object>> universities=universityMapper.selectMaps(wrapper);
        return new Result(universities);
    }
}
